package com.Jasper.resp;


/**
 * @ClassName: RespType
 * @Description:
 * @Author: ytm1022
 */

public class RespType<T>{
    //状态值
    private int code;
    //失败提示信息
    private String msg;
    //成功传输的数据
    private T content;

    public enum CodeType{

        SUCCESS(200),
        FAIL(100),
        UNLOGIN(101),
        UNMGR(102),
        ERROE(404);

        private int value;

        CodeType(int value) {
            this.value=value;
        }

        public int getValue() {
            return value;
        }
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getcontent() {
        return content;
    }

    public void setcontent(T content) {
        this.content = content;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        RespType<?> respType = (RespType<?>) o;

        if (code != respType.code) {
            return false;
        }
        if (msg != null ? !msg.equals(respType.msg) : respType.msg != null) {
            return false;
        }
        return content != null ? content.equals(respType.content) : respType.content == null;
    }

    @Override
    public int hashCode() {
        int result = code;
        result = 31 * result + (msg != null ? msg.hashCode() : 0);
        result = 31 * result + (content != null ? content.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "RespType{" +
                "code=" + code +
                ", msg='" + msg + '\'' +
                ", content=" + content +
                '}';
    }
}
